/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  							 script_adjust_luck_or_morale.h

	$Header: /heroes4/script_adjust_luck_or_morale.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( SCRIPT_ADJUST_LUCK_OR_MORALE_H_INCLUDED )
#define SCRIPT_ADJUST_LUCK_OR_MORALE_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "script_action_type.h"
#include "script_stack_adjustment_action.h"
#include "script_target_type.h"
#include "sized_int_types.h"
#include "creature_stack.h"

// --------------------------------------------------------------------------
// t_script_adjust_luck_or_morale class
// --------------------------------------------------------------------------

class t_script_adjust_attribute
	:	public t_script_stack_adjustment_action< t_uint8 >
{
public:
	t_script_adjust_attribute(t_stat_type attrib, int direction) 
		: m_attribute(attrib), m_direction(direction) {}

	virtual void	add_icons(t_basic_dialog* dialog) const;

	virtual bool	read_from_map(
						std::streambuf &	stream,
						int					format_version );

protected:
	t_stat_type		m_attribute;
	int				m_direction;

	virtual void make_adjustment(t_creature_stack* stack) const;
	virtual void make_adjustment(t_creature_array* array) const;
};

class t_script_increase_morale
	:	public t_script_adjust_attribute
{
public:
	t_script_increase_morale() : t_script_adjust_attribute(k_stat_morale, 1) {}
};

class t_script_decrease_morale
	:	public t_script_adjust_attribute
{
public:
	t_script_decrease_morale() : t_script_adjust_attribute(k_stat_morale, -1) {}
};

class t_script_increase_luck
	:	public t_script_adjust_attribute
{
public:
	t_script_increase_luck() : t_script_adjust_attribute(k_stat_luck, 1) {}
};

class t_script_decrease_luck
	:	public t_script_adjust_attribute
{
public:
	t_script_decrease_luck() : t_script_adjust_attribute(k_stat_luck, -1) {}
};

SPECIALIZE_SCRIPT_ACTION( k_script_action_decrease_luck, t_script_decrease_luck );
SPECIALIZE_SCRIPT_ACTION( k_script_action_increase_luck, t_script_increase_luck );
SPECIALIZE_SCRIPT_ACTION( k_script_action_decrease_morale, t_script_decrease_morale );
SPECIALIZE_SCRIPT_ACTION( k_script_action_increase_morale, t_script_increase_morale );

#endif // !defined( SCRIPT_ADJUST_LUCK_OR_MORALE_H_INCLUDED )
